package com.zidian.teacher.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.zidian.teacher.R;
import com.zidian.teacher.event.DeleteImageEvent;

import org.greenrobot.eventbus.EventBus;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by GongCheng on 2016/11/24.
 */

public class NewPhotoActivity extends AppCompatActivity {


    @Bind(R.id.photo_iv)
    ImageView photoIv;

    private int position;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new_photo_pick);
        String image = getIntent().getStringExtra("imagePath");
        position = getIntent().getIntExtra("position",-1);
        ButterKnife.bind(this);
        Glide.with(this).load(image).into(photoIv);

    }

    @OnClick({R.id.photo_exit_ib,R.id.photo_enter_ib})
    public void exit(){
        finish();
    }

    @OnClick(R.id.photo_delete_ib)
    public void delete(){
        EventBus.getDefault().post(new DeleteImageEvent(position));
        finish();
    }
}
